require(["../../conf/config.js"], () => { 
	require(["jquery", "swiper", "common", "template", "jquery-ui"], function($, Swiper, com, Tmplt, ui) {
		$.ajax({ //城市
					url: "http://localhost:8000/hyg",
					success: function(data) {
						console.log(data.HotCity[0].AreaName);
						let cityhot = document.getElementById("city-hot");
						let htmlstr1 = Tmplt("hotcity", {
							data
						});
						cityhot.innerHTML += htmlstr1;
						
						let city1 = document.getElementById("city1");
						let htmlstr2 = Tmplt("Cty1", {
							data
						});
						city1.innerHTML += htmlstr2;
		
						let city2 = document.getElementById("city2");
						let htmlstr3 = Tmplt("Cty2", {
							data
						});
						city2.innerHTML += htmlstr3;
						
						let city3 = document.getElementById("city3");
						let htmlstr4 = Tmplt("Cty3", {
							data
						});
						city3.innerHTML += htmlstr4;
						
						let city4 = document.getElementById("city4");
						let htmlstr5 = Tmplt("Cty4", {
							data
						});
						city4.innerHTML += htmlstr5;
						
						let city5 = document.getElementById("city5");
						let htmlstr6 = Tmplt("Cty5", {
							data
						});
						city5.innerHTML += htmlstr6;
					}
				})
				$(".citytab span:eq(0)").mouseover(function() {
					$("#city1").addClass('block');
					$("#city2").removeClass('block');
					$("#city3").removeClass('block');
					$("#city4").removeClass('block');
					$("#city5").removeClass('block');
				})
				$(".citytab span:eq(1)").mouseover(function() {
					$("#city1").removeClass('block');
					$("#city2").addClass('block');
					$("#city3").removeClass('block');
					$("#city4").removeClass('block');
					$("#city5").removeClass('block');
				})
				$(".citytab span:eq(2)").mouseover(function() {
					$("#city3").addClass('block');
					$("#city1").removeClass('block');
					$("#city2").removeClass('block');
					$("#city5").removeClass('block');
					$("#city4").removeClass('block');
				})
				$(".citytab span:eq(3)").mouseover(function() {
					$("#city4").addClass('block');
					$("#city1").removeClass('block');
					$("#city2").removeClass('block');
					$("#city5").removeClass('block');
					$("#city3").removeClass('block');
				})
				$(".citytab span:eq(4)").mouseover(function() {
					$("#city5").addClass('block');
					$("#city1").removeClass('block');
					$("#city2").removeClass('block');
					$("#city3").removeClass('block');
					$("#city4").removeClass('block');
				})
				$(".shopping-cart").mouseover(function(){
					$(".shopping-list").show();
				})
				$(".shopping-cart").mouseout(function(){
					$(".shopping-list").hide();
				})
				$(".catalogs-list .item").mouseover(function(){
					$(this).children(".sub-item").show();
				})
				$(".catalogs-list .item").mouseout(function(){
					$(this).children(".sub-item").hide();
				})
				$(".city").mouseenter(function(){
					$
					$(".city-name").children(".s1").toggleClass('Rotate');
				})
				$(".city").mouseleave(function(){
					$(".city-name").children(".s1").toggleClass('Rotate');
				})
				//搜索框
				$("#searchInput").autocomplete({
					source: function(request, response) {
						console.log(request);
						$.ajax({
							url: "http://search.yiguo.com/ajax/fullsearch.ashx",
							dataType: "jsonp", 
							data: { 
								term : request.term
							},
							jsonp: "jsoncallback",
							success: function(data) {
								console.log(data);
								response(data);
							}
						});
					},
					select: function(event, ui) {
						alert(ui.item.value);
					}
				});
				$(".catalogs").mouseenter(function(){
					// console.log(1);
					$(this).find(".catalogs-list").css("display","block");
				})
				$(".catalogs").mouseleave(function(){
					// console.log(1);
					$(this).find(".catalogs-list").css("display","none");
				})
				$(".picList li").mouseenter(function(){
					console.log(1);
					$(".pic-big img").each(function(){
						console.log();
						$(this).css("display","inline");
					})
				})
			})
		
		});